<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="/style.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script>
    
    <title> Chat </title>
</head>
<body>
    <div id="app">
        
        <div class="row">
            <div class="col-md-3" id="active-user">                    
                <div class="form-group">
                    <h3 v-if="username">Hello {{ username }}</h3>
                    <div v-else>
                        <h3>Enter a username</h3>
                        <input type="text" @Keyup.enter="getUser" placeholder="Username" class="form-control">
                    </div>
                </div>
            </div>
            
            <div class="col-md-9" id="chat-room">
                <div v-if="username">
                    <div>
                        <div style="border-bottom: 1px solid black">
                            <h2>{{ username }}</h2>
                        </div>

                        <div v-for="chat in chats" id="chat-box">
                            <p> {{chat.mood}} </p>
                            <p> <b>{{ chat.user }}</b></p>
                            <p id="chat-message"> {{ chat.message }} </p>
                        </div>
                    </div>
                    <div class="form-group">
                        <textarea placeholder="Type a message here then hit ENTER"  @Keyup.enter="postMessages"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.16.2/axios.js"></script>
    <script src="https://js.pusher.com/4.1/pusher.min.js"></script>
    <script src="/main.js"></script>
</body>
</html>